home *** CD-ROM | disk | FTP | other *** search
- /**
- * MENU.C Display several types of keyboard-activated
- * menus.
- *
- * This program displays a series of menus on the screen, allowing
- * the user to choose which of several types of menus will be
- * displayed.
- *
- * Five menus are used. The main menu allows the user to select
- * one of four other menus or to terminate the program. The
- * main menu is an example of a vertical menu style; the other
- * four exhibit horizontal, grid, Lotus-style, and virtual menus,
- * respectively.
- *
- * The command line format is as follows:
- *
- * menu [/c | /d | /a]
- *
- * The user may specify either /c, /d, or /a, corresponding to the
- * type of mouse style they wish to use; click, drag, or alternate
- * drag, respectively. If no switch is specified, the default is
- * click.
- *
- * The two purposes of MENU are to show off the menuing
- * capabilities of Turbo C TOOLS, and to provide a working example
- * of the proper method of construction and use of the menu
- * functions.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1987-1989
- *
- **/
-
- #include <ctype.h>
- #include <stdio.h>
-
- #include <bkeybrd.h>
- #include <bkeys.h>
- #include <bmenu.h>
- #include <butil.h>
- #include <bmouse.h>
-
- /* Text color is intense white on blue. */
- #define MYTEXTATR (utnybbyt (SC_BLUE, NORMAL | INTENSITY))
-
- /* "Lotus" description color is intense magenta on */
- /* blue. */
- #define MYLNGATTR (utnybbyt (SC_BLUE, SC_MAGENTA | INTENSITY))
-
- /* Color of highlight bar is black text on a white */
- /* background. */
- #define MYHILATR (utnybbyt (NORMAL, SC_BLACK))
-
- /* Color of "protected" items is green on blue. */
- #define MYPROATR (utnybbyt (SC_BLUE, SC_GREEN))
-
- /* Color of menu borders is cyan on black. */
- #define MYBORDATR (utnybbyt (SC_BLACK, SC_CYAN))
-
- /* Color of menu titles is the same as menu borders.*/
- #define MYTITATR MYBORDATR
-
- #define NUL '\0'
- #define TRUE 1
- #define FALSE 0
-
- /* Terminate-on-error macro. */
- #define exitBad() \
- { \
- mohide(MO_HIDE); \
- fprintf (stderr, \
- "menu: died with b_wnerr = %d in line %d", \
- b_wnerr, __LINE__); \
- exit (b_wnerr); \
- }
-
-
- /* Declare function prototypes. */
- void main (int, char **);
- void horizontal (int, int, int, int, int *, int *);
- void lotus (int, int, int, int, int *, int *);
- void grid (int, int, int, int, int *, int *);
- void virtual (int, int, int, int, int *, int *);
-
-
- void main (argc, argv)
- int argc;
- char **argv;
- {
- BMENU *pmenu;
- BORDER border;
- WHERE where;
- int ch, scan;
- int row, col;
- int rrow, rcol;
- int showrow, showcol;
- int adapter, mode, cols, apage;
- int coff, crow, ccol, chigh, clow;
- int done = FALSE;
- int mouse_style = MN_MOU_CLICK;
- int bad_command_line = 0;
-
- /* First, check to see if the user specified a */
- /* mouse style. */
- if (argc == 2)
- {
- /* Make sure the switch character is valid. */
- if ((argv[1][0] == '/') || (argv[1][0] == '-'))
- {
- /* Make sure the option character is valid. */
- switch(toupper(argv[1][1]))
- {
- case 'C':
- mouse_style = MN_MOU_CLICK;
- break;
- case 'D':
- mouse_style = MN_MOU_DRAG;
- break;
- case 'A':
- mouse_style = MN_MOU_ALT_DRAG;
- break;
- default:
- bad_command_line = 1;
- break;
- }
- }
- else
- bad_command_line = 1;
- }
- else
- if (argc > 2)
- bad_command_line = 1;
-
- if (bad_command_line)
- {
- fprintf(stderr, "Usage: menu [/c | /d | /a].\n");
- exit(1);
- }
-
-
- /* Now we make certain that we are in 80 column */
- /* text video mode. */
- adapter = scmode (&mode, &cols, &apage);
- switch (mode)
- {
- case 2:
- case 3:
- case 7:
- break;
-
- default:
- fprintf (stderr,
- "menu: This demonstration works only in 80 column\n");
- fprintf (stderr,
- " text modes (modes 2, 3, and 7)\n");
- exit (1);
- }
-
- /* Save cursor position and style to restore later. */
- coff = sccurst (&crow, &ccol, &chigh, &clow);
-
- /* Create the menu data structure. */
- if ((pmenu = mncreate (8, 14,
- MYTEXTATR, MYHILATR,
- MYPROATR, MYLNGATTR)) == NIL)
- exitBad ()
-
- /* Set up items on the menu, and define */
- /* corresponding keys (upper and lower case of the */
- /* first letters of the items). */
- if (mnitmkey (pmenu, 0, 1, 0, "Horizontal", "Hh", MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 1, 1, 0, "Lotus-Style", "Ll", MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 2, 1, 0, "Grid", "Gg", MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 3, 1, 0, "Virtual", "Vv", MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 5, 1, 0, "Quit", "QqXx", MN_NOMOVE | MN_BEEP)
- == NIL)
- exitBad ()
-
- /* Define the following keys as selection & */
- /* transmission keys: ALT-H, ALT-L, ALT-G, ALT-V, */
- /* ALT-Q and X. */
- if (mnkey (pmenu, 0, 1, KB_C_A_H, KB_S_A_H,
- MN_SELECT | MN_TRANSMIT, MN_ADD) == NIL)
- exitBad ()
- if (mnkey (pmenu, 1, 1, KB_C_A_L, KB_S_A_L,
- MN_SELECT | MN_TRANSMIT, MN_ADD) == NIL)
- exitBad ()
- if (mnkey (pmenu, 2, 1, KB_C_A_G, KB_S_A_G,
- MN_SELECT | MN_TRANSMIT, MN_ADD) == NIL)
- exitBad ()
- if (mnkey (pmenu, 3, 1, KB_C_A_V, KB_S_A_V,
- MN_SELECT | MN_TRANSMIT, MN_ADD) == NIL)
- exitBad ()
- if (mnkey (pmenu, 5, 1, KB_C_A_Q, KB_S_A_Q,
- MN_SELECT | MN_TRANSMIT | MN_BEEP, MN_ADD) == NIL)
- exitBad ()
- if (mnkey (pmenu, 5, 1, KB_C_A_X, KB_S_A_X,
- MN_SELECT | MN_TRANSMIT | MN_BEEP, MN_ADD) == NIL)
- exitBad ()
-
- /* Disable ESC key. */
- if (mnkey (pmenu, 0, 0, KB_C_N_ESC, KB_S_N_ESC,
- MN_ABORT, MN_DELETE) == NIL)
- exitBad ()
-
- /* Now that we have put all of the menu items on */
- /* the menu in item color, set the native window */
- /* color so that additional text will appear in the */
- /* menu's window in "long-item" (description) color.*/
- wnsetopt (pmenu->pwin, WN_ATTR, MYLNGATTR);
-
- /* Figure out where to display the menu. */
- where.dev = (adapter == 0) ? SC_MONO : SC_COLOR;
- where.page = 0;
- where.corner.row = 1;
- where.corner.col = 1;
-
- /* Make a border with a top centered title. */
- border.type = BBRD_SSSS | BBRD_TCT;
- border.attr = MYBORDATR;
- border.ch = NUL;
- border.pttitle = "Menu Styles";
- border.ttattr = MYTITATR;
-
- /* Display the menu on the screen. */
- if (mndsplay (pmenu, &where, &border) == NIL)
- exitBad ()
-
- /* Set up starting row and column for highlight bar.*/
- row = 0;
- col = 1;
-
- /* If the mouse is present, enable its cursor. */
- if (MO_OK == mohide(MO_SHOW))
- if (NULL == mnmstyle(pmenu, mouse_style, MO_LEFT))
- exitBad ()
-
- /* Leave this menu on the screen until they select */
- /* the "Quit" entry. */
- do
- {
- /* Read a response from the menu. */
- if (mnread (pmenu, row, col, &row, &col, &ch, &scan,
- MN_KEEP_HIGHLIGHT))
- exitBad ()
-
- /* Set up location to show sub-menu. */
- showrow = where.corner.row + row + 2;
- showcol = where.corner.col + col + 0;
-
- /* Go do what was requested. */
- switch (row)
- {
- case 0:
- horizontal (where.dev, showrow, showcol, mouse_style,
- &rrow, &rcol);
- break;
- case 1:
- lotus (where.dev, showrow, showcol, mouse_style,
- &rrow, &rcol);
- break;
- case 2:
- grid (where.dev, showrow, showcol, mouse_style,
- &rrow, &rcol);
- break;
- case 3:
- virtual (where.dev, showrow, showcol, mouse_style,
- &rrow, &rcol);
- break;
- case 5:
- done = TRUE;
- }
-
- /* At this point, rrow and rcol contain the row and */
- /* column of the item selected from the submenu. */
- if (!done)
- { /* Tell the user what was selected from the submenu.*/
- if (b_pcurwin != pmenu->pwin)
- wnselect (pmenu->pwin);
- wnscrblk (b_pcurwin, 6, 0, 6, 13, -1, -1, 0, 0, 0);
- wncurmov (6, 1);
- wnprintf ("xmit (%d %d)", rrow, rcol);
- }
- } while (!done);
-
- mndstroy (pmenu);
-
- mohide(MO_HIDE);
-
- /* Restore cursor position and style. */
- sccurset (crow, ccol);
- scpgcur (coff, chigh, clow, CUR_NO_ADJUST);
- }
-
-
-
- /**
- *
- * Name HORIZONTAL -- Display and allow user selection from
- * a simple horizontal menu.
- *
- * Synopsis horizontal (dev, row, col, prrow, prcol);
- *
- * int dev Device on which to display the
- * menu. Either SC_COLOR or SC_MONO.
- * int row, col Row and column where the upper-
- * left corner of the menu's data
- * area should appear.
- * int mouse_style The mouse style to use.
- * int *prrow, Pointers to variables in which to
- * *prcol return the row and column selected
- * from the menu.
- *
- * Description This function constructs a simple horizontal menu,
- * and waits for user input. It then returns the row
- * and column of the selection to its caller.
- *
- * Returns *prrow, *prcol Row and column (relative to menu) of
- * user selection.
- *
- **/
-
-
- void horizontal (dev, row, col, mouse_style, prrow, prcol)
- int dev;
- int row, col;
- int mouse_style;
- int *prrow, *prcol;
- {
- BMENU *pmenu;
- BORDER border;
- WHERE where;
- int ch, scan;
-
- /* Figure out where to display the menu. */
- where.dev = dev;
- where.page = 0;
- where.corner.row = row;
- where.corner.col = col;
-
- /* Create the menu data structure. */
- if ((pmenu = mncreate (1, 28,
- MYTEXTATR, MYHILATR,
- MYPROATR, MYLNGATTR)) == NIL)
- exitBad ()
-
- /* Set up items on the menu, and add keys to the key*/
- /* binding list (upper and lower case of the first */
- /* letters of the items. */
- if (mnitmkey (pmenu, 0, 1, 0, "My dog", "MmDd", MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 0, 9, 0, "has", "Hh", MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 0, 14, 0, "itchy", "Ii", MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 0, 21, 0, "fleas.", "Ff", MN_NOMOVE) == NIL)
- exitBad ()
-
- /* Disable ESC key. */
- if (mnkey (pmenu, 0, 0, KB_C_N_ESC, KB_S_N_ESC,
- MN_ABORT, MN_DELETE) == NIL)
- exitBad ()
-
- /* Make a border with a bottom centered title. */
- border.type = BBRD_SSSS | BBRD_BCT;
- border.attr = MYBORDATR;
- border.ch = NUL;
- border.pbtitle = "Horizontal Menu";
- border.btattr = MYTITATR;
-
- /* Display the menu on the screen. */
- if (mndsplay (pmenu, &where, &border) == NIL)
- exitBad ()
-
- /* Make menu aware of the mouse. */
- if (NULL == mnmstyle(pmenu, mouse_style, MO_LEFT))
- exitBad ()
-
- /* Read a response from the menu. */
- if (mnread (pmenu, 0, 1, prrow, prcol, &ch, &scan, MN_DESTROY))
- exitBad ()
- }
-
-
-
-
- /**
- *
- * Name LOTUS -- Display and allow user selection from a
- * "Lotus"-style menu.
- *
- * Synopsis lotus (dev, row, col, prrow, prcol);
- *
- * int dev Device on which to display the
- * menu. Either SC_COLOR or SC_MONO.
- * int row, col Row and column where the upper-
- * left corner of the menu's data
- * area should appear.
- * int mouse_style The mouse style to use.
- * int *prrow, Pointers to variables in which to
- * *prcol return the row and column selected
- * from the menu.
- *
- * Description This function constructs a "Lotus" menu, and
- * waits for user input. It then returns the row
- * and column of the selection to its caller.
- *
- * Returns *prrow, *prcol Row and column (relative to menu) of
- * user selection.
- *
- **/
-
-
- void lotus (dev, row, col, mouse_style, prrow, prcol)
- int dev;
- int row, col;
- int mouse_style;
- int *prrow, *prcol;
- {
- BMENU *pmenu;
- BORDER border;
- WHERE where;
- int ch, scan;
-
- /* Figure out where to display the menu. */
- where.dev = dev;
- where.page = 0;
- where.corner.row = row;
- where.corner.col = col;
-
- /* Create the menu data structure. */
- if ((pmenu = mncreate (2, 70,
- MYTEXTATR, MYHILATR,
- MYPROATR, MYLNGATTR)) == NIL)
- exitBad ()
-
- /* Set up items on the menu, and add keys to the key*/
- /* binding list (upper and lower case of the first */
- /* letters of the items. */
- if (mnlitkey (pmenu, 0, 0, 0, "Worksheet", 1, 0,
- "Global, Insert, Delete, Column-Width, Erase, Titles, Window, Status",
- "Ww", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- if (mnlitkey (pmenu, 0, 11, 0, "Range", 1, 0,
- "Format, Label-Prefix, Erase, Name, Justify, Protect, Unprotect, Input",
- "Rr", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- if (mnlitkey (pmenu, 0, 18, 0, "Copy", 1, 0,
- "Copy a cell or range of cells",
- "Cc", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- if (mnlitkey (pmenu, 0, 24, 0, "Move", 1, 0,
- "Move a cell or range of cells",
- "Mm", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- if (mnlitkey (pmenu, 0, 30, 0, "File", 1, 0,
- "Retrieve, Save, Combine, Xtract, Erase, List, Import, Directory",
- "Ff", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- if (mnlitkey (pmenu, 0, 36, 0, "Print", 1, 0,
- "Output a range to the printer or a print file",
- "Pp", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- if (mnlitkey (pmenu, 0, 43, 0, "Graph", 1, 0,
- "Create a graph",
- "Gg", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- if (mnlitkey (pmenu, 0, 50, 0, "Data", 1, 0,
- "Fill, Table, Sort, Query, Distribution",
- "Dd", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- if (mnlitkey (pmenu, 0, 56, 0, "Quit", 1, 0,
- "End 3-2-1 Session (Have you saved your play ?)",
- "Qq", MN_NOMOVE | MN_TRANSMIT) == NIL)
- exitBad ()
-
- /* Disable ESC key. */
- if (mnkey (pmenu, 0, 0, KB_C_N_ESC, KB_S_N_ESC,
- MN_ABORT, MN_DELETE) == NIL)
- exitBad ()
-
- /* Make a border with a top centered title. */
- border.type = BBRD_SDDD | BBRD_TCT;
- border.attr = MYBORDATR;
- border.ch = NUL;
- border.pttitle = "Lotus Menu (with top-centered title)";
- border.ttattr = MYTITATR;
-
- /* Display the menu on the screen. */
- if (mndsplay (pmenu, &where, &border) == NIL)
- exitBad ()
-
- /* Make menu aware of the mouse. */
- if (NULL == mnmstyle(pmenu, mouse_style, MO_LEFT))
- exitBad ()
-
- /* Read a response from the menu. */
- if (mnlread (pmenu, 0, 0, prrow, prcol, &ch, &scan, MN_DESTROY))
- exitBad ()
- }
-
-
-
-
- /**
- *
- * Name GRID -- Display and allow user selection from a
- * grid menu.
- *
- * Synopsis grid (dev, row, col, prrow, prcol);
- *
- * int dev Device on which to display the
- * menu. Either SC_COLOR or SC_MONO.
- * int row, col Row and column where the upper-
- * left corner of the menu's data
- * area should appear.
- * int mouse_style The mouse style to use.
- * int *prrow, Pointers to variables in which to
- * *prcol return the row and column selected
- * from the menu.
- *
- * Description This function constructs a grid menu, and
- * waits for user input. It then returns the
- * row and column of the selection to its caller.
- *
- * Returns *prrow, *prcol Row and column (relative to menu) of
- * user selection.
- *
- **/
-
-
- void grid (dev, row, col, mouse_style, prrow, prcol)
- int dev;
- int row, col;
- int mouse_style;
- int *prrow, *prcol;
- {
- BMENU *pmenu;
- BORDER border;
- WHERE where;
- int ch, scan, x, y;
- char s[3];
-
- /* Figure out where to display the menu. */
- where.dev = dev;
- where.page = 0;
- where.corner.row = row;
- where.corner.col = col;
-
- /* Create the menu data structure. */
- if ((pmenu = mncreate (6, 40,
- MYTEXTATR, MYHILATR,
- MYPROATR, MYLNGATTR)) == NIL)
- exitBad ()
-
- /* Set up items on the menu. We will make a grid */
- /* of numbers from 0 to 47, in rows across the */
- /* menu. */
- for (y = 0; y < 6; y++)
- for (x = 0; x < 8; x++)
- /* Put a the ASCII characters for a number (y*8+x) */
- /* at location (y, x*5) in the menu. */
- if (mnitem (pmenu, y, (x * 5), 0,
- itoa (((y * 8) + x), s, 10)) == NIL)
- exitBad ()
-
- /* Disable ESC key. */
- if (mnkey (pmenu, 0, 0, KB_C_N_ESC, KB_S_N_ESC,
- MN_ABORT, MN_DELETE) == NIL)
- exitBad ()
-
- /* Make a border with a bottom left title. */
- border.type = BBRD_SSSS | BBRD_BLT;
- border.attr = MYBORDATR;
- border.ch = NUL;
- border.pbtitle = "Grid Menu (bottom left title)";
- border.btattr = MYTITATR;
-
- /* Display the menu on the screen. */
- if (mndsplay (pmenu, &where, &border) == NIL)
- exitBad ()
-
- /* Make menu aware of the mouse. */
- if (NULL == mnmstyle(pmenu, mouse_style, MO_LEFT))
- exitBad ()
-
- /* Read a response from the menu. */
- if (mnread (pmenu, 0, 0, prrow, prcol, &ch, &scan, MN_DESTROY))
- exitBad ()
- }
-
-
- /**
- *
- * Name VIRTUAL -- Display and allow user selection from
- * a virtual menu.
- *
- * Synopsis virtual (dev, row, col, prrow, prcol);
- *
- * int dev Device on which to display the
- * menu. Either SC_COLOR or SC_MONO.
- * int row, col Row and column where the upper-
- * left corner of the menu's data
- * area should appear.
- * int mouse_style The mouse style to use.
- * int *prrow, Pointers to variables in which to
- * *prcol return the row and column selected
- * from the menu.
- *
- * Description This function constructs a virtual menu, and waits
- * for user input. It then returns the row and column of
- * the selection to its caller.
- *
- * Returns *prrow, *prcol Row and column (relative to menu) of
- * user selection.
- *
- **/
-
-
- void virtual (dev, row, col, mouse_style, prrow, prcol)
- int dev;
- int row, col;
- int mouse_style;
- int *prrow, *prcol;
- {
- BMENU *pmenu;
- BORDER border;
- WHERE where;
- int ch, scan;
-
- /* Figure out where to display the menu. */
- where.dev = dev;
- where.page = 0;
- where.corner.row = row;
- where.corner.col = col;
-
- /* Create the menu data structure. */
- if ((pmenu = mncreate (7, 39,
- MYTEXTATR, MYHILATR,
- MYPROATR, MYLNGATTR)) == NIL)
- exitBad ()
-
- /* Set up items on the menu, and add keys to the key*/
- /* binding list (upper and lower case of the first */
- /* letters of the items). */
-
- /* First, items on the menu at a Chinese restaraunt.*/
- if (mnitmkey (pmenu, 0, 0, 0, "Mandarin Chicken", "Mm",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 1, 0, 0, "Broccoli Beef", "Bb",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 2, 0, 0, "Sweet & Sour Pork", "Ss",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 3, 0, 0, "Won Ton Soup", "Ww",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 4, 0, 0, "Pork Fried Rice", "Pp",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 5, 0, 0, "Potstickers", "Pp",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 6, 0, 0, "Fortune Cookies", "Ff",
- MN_NOMOVE) == NIL)
- exitBad ()
-
- /* Now, items on the menu at an Italian restaraunt. */
- if (mnitmkey (pmenu, 0, 19, 0, "Lasagna", "Ll",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 1, 19, 0, "Tortellini Pesto", "Tt",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 2, 19, 0, "Ravioli w/Meat Sauce", "Rr",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 3, 19, 0, "Fettucini Al Fredo", "Ff",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 4, 19, 0, "Veal Parmesan", "Vv",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 5, 19, 0, "Linguini", "Ll",
- MN_NOMOVE) == NIL)
- exitBad ()
- if (mnitmkey (pmenu, 6, 19, 0, "Calamari", "Cc",
- MN_NOMOVE) == NIL)
- exitBad ()
-
- /* Disable ESC key. */
- if (mnkey (pmenu, 0, 0, KB_C_N_ESC, KB_S_N_ESC,
- MN_ABORT, MN_DELETE) == NIL)
- exitBad ()
-
- /* Make a border with a bottom centered title. */
- border.type = BBRD_SSSS | BBRD_BCT;
- border.attr = MYBORDATR;
- border.ch = NUL;
- border.pbtitle = "Virtual";
- border.btattr = MYTITATR;
-
- /* Display the menu in a 4 X 30 viewport. */
- if (mnvdisp (pmenu, &where, 4, 30, 0, 0, &border) == NIL)
- exitBad ()
-
- /* Make menu aware of the mouse. */
- if (NULL == mnmstyle(pmenu, mouse_style, MO_LEFT))
- exitBad ()
-
- /* Read a response from the menu. */
- if (mnread (pmenu, 0, 0, prrow, prcol, &ch, &scan, MN_DESTROY))
- exitBad ()
- }